package ${config.package_serviceImpl};


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import ${config.package_entity}.${table.class_name}${config.suffix_entity};
import ${config.package_service}.${table.class_name}${config.suffix_service};

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import com.kye.outside.transport.plugin.validate.FieldValidate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <#if table.annotation??>${table.annotation}</#if>控制层
 * @author ${config.author}
 * @date ${.now?string("yyyy-MM-dd HH:mm:ss")}
 */
@RestController
@RequestMapping({"/${StringUtil.firstFiledLower(table.class_name)}"})
@Api(value = "<#if table.annotation??>${table.annotation}</#if>", tags = {"<#if table.annotation??>${table.annotation}</#if>"})
public class ${table.class_name}${config.suffix_controller}{
	

    @Autowired
    private ${table.class_name}${config.suffix_service} ${StringUtil.firstFiledLower(table.class_name)}${config.suffix_service};
    
	/**
	 * 新增<#if table.annotation??>${table.annotation}</#if>
	 * @param ${StringUtil.firstFiledLower(table.class_name)}
	 * @return
	 */
	@PostMapping("driver/auth/create${table.class_name}.do")
    @ApiOperation("新增<#if table.annotation??>${table.annotation}</#if>")
	@FieldValidate
	public String create${table.class_name}(${table.class_name}${config.suffix_entity} ${StringUtil.firstFiledLower(table.class_name)}){
		${StringUtil.firstFiledLower(table.class_name)}${config.suffix_service}.create${table.class_name}(${StringUtil.firstFiledLower(table.class_name)});
		return "OK";
	}
	
	/**
	 * 更新<#if table.annotation??>${table.annotation}</#if>
	 * @param ${StringUtil.firstFiledLower(table.class_name)}
	 * @return
	 */
	@PostMapping("driver/auth/update${table.class_name}.do")
    @ApiOperation("修改<#if table.annotation??>${table.annotation}</#if>")
	@FieldValidate
	public String update${table.class_name}(${table.class_name}${config.suffix_entity} ${StringUtil.firstFiledLower(table.class_name)}){
		${StringUtil.firstFiledLower(table.class_name)}${config.suffix_service}.update${table.class_name}(${StringUtil.firstFiledLower(table.class_name)});
		return "OK";
	}
	
	/**
	 * <#if table.annotation??>${table.annotation}</#if>列表
	 * @return
	 */
	@PostMapping("driver/auth/find${table.class_name}List.do")
    @ApiOperation("<#if table.annotation??>${table.annotation}</#if>列表查询")
	public List<${table.class_name}${config.suffix_entity}> find${table.class_name}List(){
		return ${StringUtil.firstFiledLower(table.class_name)}${config.suffix_service}.select${table.class_name}List();
	}
	
	/**
	 * <#if table.annotation??>${table.annotation}</#if>详情
	 * @param id 主键id
	 * @return
	 */
	@PostMapping("driver/auth/find${table.class_name}.do")
    @ApiOperation("<#if table.annotation??>${table.annotation}</#if>列表查询")
	public ${table.class_name}${config.suffix_entity} find${table.class_name}(Integer ${table.primary_key_field}){
		return ${StringUtil.firstFiledLower(table.class_name)}${config.suffix_service}.select${table.class_name}(${table.primary_key_field});
	}


}
